package com.gonsin.gview.model.dynamic.form;

import com.gonsin.gview.model.GFormItemModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@ApiModel("分隔线")
@AllArgsConstructor
@NoArgsConstructor
public class DynamicLine extends DynamicFormItem {

    @ApiModelProperty("text_input表示文本框，还有check_box\\file\\radio\\rich_text\\text_input\\tree_check_box\\tree_selector")
    private String itemType = "line";

    @ApiModelProperty("分隔线显示的文本")
    private String name;

    @ApiModelProperty("根据情况显示")
    private String showIf = "1";


    public static DynamicLineBuilder builder() {
        return new DynamicLineBuilder();
    }

    public static final class DynamicLineBuilder {
        @ApiModelProperty("分隔线显示的文本")
        private String name;

        @ApiModelProperty("根据情况显示")
        private String showIf = "1";

        private DynamicLineBuilder() {
        }

        public DynamicLineBuilder name(String name) {
            this.name = name;
            return this;
        }

        public DynamicLineBuilder showIf(String showIf) {
            this.showIf = showIf;
            return this;
        }

        public DynamicLine build() {
            DynamicLine dynamicLine = new DynamicLine();
            dynamicLine.setName(name);
            dynamicLine.setShowIf(showIf);
            return dynamicLine;
        }
    }
}
